import { createRouter, createWebHistory } from 'vue-router'
const Index = () => import('@/views/Index')
const Home = () => import('@/views/Home')
const Cultivate = () => import('@/views/Cultivate')
const Materials = () => import('@/views/Materials')
const Recruit = () => import('@/views/Recruit')
const Login = () => import('@/views/Login')
const User = () => import('@/views/User')

const routes = [
  {
    path: '/',
    redirect: '/home',
    name: 'home',
    component: Index,
    children: [
      {
        path: 'home',
        component: Home
      },
      {
        path: 'recruit',
        component: Recruit
      },
      {
        path: 'cultivate',
        component: Cultivate
      },
      {
        path: 'materials',
        component: Materials
      },
    ]
  },
  {
    path: '/login',
    name: Login,
    component: Login,
  },
  {
    path: '/user',
    name: 'user',
    component: User,
    meta: {
      auth: true
    }
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
